	<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tbody>
	<tr valign="top">
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td><hr align="left" color="#89a00f" width="100%" /></td>
	</tr>
	</tbody>
	</table>
<span class="topic">ฐานข้อมูลรหัสหน่วยงาน</span>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tbody>
	<tr valign="top">
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td width="20"><hr align="left" color="#89a00f" width="70%" /></td>
		<td><hr align="left" color="#89a00f" width="100%" /></td>
	</tr>
	</tbody>
	</table><br />
<?php
if(isset($_POST['update_depart_code']))
{
	$r = updateDepartCode($_POST['depart_id'],$_POST['depart_code']);
	if($r==-1) echo "<span class=\"err\">ERROR : ไม่สามารถแก้ไขรหัสหน่วยงาน <span class=\"topic\">".get_depart_name($_POST['depart_id'])."</span> เป็น <span class=\"topic\">".$_POST['depart_code']."</span> ได้</span><br /><br />";
	else echo "แก้ไขรหัสหน่วยงาน <span class=\"topic\">".get_depart_name($_POST['depart_id'])."</span> เป็น <span class=\"topic\">".$_POST['depart_code']."</span> เรียบร้อยแล้ว<br /><br />";
}
?>	
	
<form action="update.php" method="post" id="depart_code_form">
<input type="hidden" name="domain" value="depart_code">

<table cellpadding="5" cellspacing="0" border="0">
<tr><td>หน่วยงาน</td><td>:</td><td>
<?php 
	if(!isset($_POST['listdepartcode']) & (!isset($_POST['update_depart_code']))) list_department_user(0,"depart_code_form"); 
	else list_department_user($_POST['depart_id'],"depart_code_form");
?>
</td></tr>
</table>
<input type="hidden" name="listdepartcode" value="แสดงรหัสหน่วยงาน">
</form><br />

<form action="update.php" method="post">
<input type="hidden" name="domain" value="depart_code">

<?php
	if(!isset($_POST['listdepartcode']) & (!isset($_POST['update_depart_code']))) echo "<input type=\"hidden\" name=\"depart_id\" value=\"".$_SESSION['edoc_depart_id']."\">";
	else echo "<input type=\"hidden\" name=\"depart_id\" value=\"".$_POST['depart_id']."\">";
?>
<table cellpadding="5" cellspacing="0" border="0">
<tr><td>รหัสหน่วยงาน</td><td>:</td><td>
<?php
	if(!isset($_POST['listdepartcode']) & (!isset($_POST['update_depart_code']))) echo "<input type=\"text\" name=\"depart_code\" value=\"".getDepartCode($_SESSION['edoc_depart_id'])."\" size=\"30\" maxlength=\"450\" >";
	else echo "<input type=\"text\" name=\"depart_code\" value=\"".getDepartCode($_POST['depart_id'])."\" size=\"30\" maxlength=\"450\" >";
?>
</td></tr>
<tr><td></td><td></td><td><input type="submit" name="update_depart_code" value=" แก้ไขรหัสหน่วยงาน "></td></tr>
</table>
</form>

